<script>
var langPieChart = echarts.init(document.getElementById('langpie'));
window.addEventListener('resize', function() {
    langPieChart.resize();
});
var optionlangpie;
optionlangpie = {
  tooltip: {
    trigger: 'item'
  },
  legend: {
    top: '5%',
    left: 'center'
  },
  series: [
    {
      name: 'Languages',
      type: 'pie',
      radius: ['40%', '70%'],
      avoidLabelOverlap: false,
      itemStyle: {
        borderRadius: 10,
        borderColor: '#fff',
        borderWidth: 2
      },
      label: {
        show: false,
        position: 'center'
      },
      emphasis: {
        label: {
          show: true,
          fontSize: 40,
          fontWeight: 'bold'
        }
      },
      labelLine: {
        show: false
      },
      data: {{ languages_stats|tojson }}
    }
  ]
};
langPieChart.setOption(optionlangpie);
langPieChart.on('click', function (params) {
    console.log(params.name);
    window.open('{{ lang_endpoint|safe }}' + params.name)
});

</script>